package com.technology.education.ui.student.evaluate

import androidx.lifecycle.MutableLiveData
import com.technology.education.data.model.TeacherOrderDetailModel
import com.technology.education.ext.toast
import com.technology.education.network.apiService
import me.hgj.jetpackmvvm.base.viewmodel.BaseViewModel
import me.hgj.jetpackmvvm.ext.request
import me.hgj.jetpackmvvm.state.ResultState

class EvaluateResultViewModel:BaseViewModel() {
    var orderId = ""
    val result = MutableLiveData<ResultState<TeacherOrderDetailModel>>()

    override fun getData() {
        super.getData()
        request({ apiService.teachOrderDetail(orderId) }, result)
    }

    fun collectTeacher(id: String, state: String) {
        request(
            { apiService.collectTeacher(hashMapOf("id" to id, "state" to state)) },
            success = {},
            error = { toast(it.errorMsg) })
    }
}